package com.bitcola.security.dataservice.controller;


import com.bitcola.security.dataservice.biz.ColaUserBiz;
import com.bitcola.entity.ColaMeBalance;
import com.bitcola.entity.ColaUserEntity;
import com.bitcola.entity.ColaUserKyc;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * 用户信息
 *
 *  @author wx
 * @create 2018-09-03 14:11
 **/
@RestController
@RequestMapping("user")
public class ColaUserController {

    @Autowired
    ColaUserBiz biz;

    @Autowired
    MongoTemplate mongoTemplate;

    @RequestMapping(value = "getColaToken",method = RequestMethod.GET)
    public ColaMeBalance getColaToken(@RequestParam("userId") String userId){
        return biz.getColaToken(userId);
    }

    @RequestMapping(value = "infoByIds",method = RequestMethod.POST)
    public List<ColaUserEntity> infoByIds(@RequestBody ArrayList<String> userIds){
        return biz.infoByIds(userIds);
    }

    @RequestMapping(value = "info",method = RequestMethod.GET)
    public ColaUserEntity info(@RequestParam("userId") String userId){
        return biz.info(userId);
    }

    @RequestMapping(value = "infoByInviterCode",method = RequestMethod.GET)
    public ColaUserEntity infoByInviterCode(@RequestParam("inviterCode") String inviterCode){
        return biz.infoByInviterCode(inviterCode);
    }

    @RequestMapping(value = "verifyPin",method = RequestMethod.GET)
    public boolean verifyPin(@RequestParam("userId")String userID, @RequestParam("pin")String pin){
        return biz.verifyPin(userID,pin);
    }







    @RequestMapping(value = "getUserKycInfo",method = RequestMethod.GET)
    public ColaUserKyc getUserKycInfo(String userId){
        return biz.getUserKycInfo(userId);
    }

    @RequestMapping(value = "findUserInvitor",method = RequestMethod.GET)
    public ColaUserEntity findUserInvitor(@RequestParam("userId")String userID){
        return biz.queryInviterUser(userID);
    }

}
